//
//  BCIndustryAdsCollectionCell.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2018/12/21.
//  Copyright © 2018 guoshikeji. All rights reserved.
//

#import "BCIndustryAdsCollectionCell.h"

#import "BCIndustryDataTitleGroupAdModel.h"

@interface BCIndustryAdsCollectionCell ()

@property (nonatomic, strong) QMUIButton *backButton;

/**
 *adImageView
 */
@property (nonatomic, strong) UIImageView *adImageView;

@end

@implementation BCIndustryAdsCollectionCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.cornerRadius = 4;
        self.layer.masksToBounds = true;
        self.alpha = 0.78;
        [self setupSubviews];
    }
    return self;
}

- (void)setupSubviews {
    self.backButton = [QMUIButton new];
    [self.contentView addSubview:self.backButton];
    [self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.contentView);
    }];
    [self.backButton setUserInteractionEnabled:false];
    //
    self.adImageView = [UIImageView new];
    self.adImageView.contentMode = UIViewContentModeScaleAspectFill;
    [self.backButton addSubview:self.adImageView];
    [self.adImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.backButton);
    }];
}
- (void)setHighlighted:(BOOL)highlighted {
    [super setHighlighted:highlighted];
    //
    self.backButton.highlighted = highlighted;
}

- (void)setAdModel:(BCIndustryDataTitleGroupAdModel *)adModel {
    _adModel = adModel;
    //
    [self.adImageView sd_setImageWithURL:[NSURL URLWithString:adModel.image_url]];
}

@end
